﻿using Manson.AuthorizationHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Manson.AuthorizationDemo
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //读取注册表
            object reg = Regedit.GetData("BMS", "BMS");
            if (reg == null)
            {
                MessageBox.Show("本软件尚未授权，请检查","授权提示");
                IsLicenced=false;
            }
            else
            {
                //校验注册码
                if(!Authorization.Check(reg.ToString()))
                {
                    MessageBox.Show("软件授权错误，软件即将关闭", "授权提示");
                    IsLicenced = false;
                }
                else
                {
                    IsLicenced = true;
                }
            }

            Application.Run(new FrmMain());

           
        }

        public static bool IsLicenced=false;   
    }
}
